package com.matrix.draft.dubbotestprovider.service.impl;

import com.matrix.draft.dubbotest.interfaces.FoodService;
import com.matrix.draft.dubbotest.pojo.dto.ChocolateDTO;
import com.matrix.draft.dubbotest.pojo.dto.Color;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.Arrays;
import java.util.Collection;

@DubboService(timeout = 3 * 1000, retries = 2,weight = 200,mock = "force:return null")
public class FoodServiceImpl implements FoodService {
    @Override
    public Collection<ChocolateDTO> getFoods() {
        return Arrays.asList(
                new ChocolateDTO().setName("德芙巧克力").setNPieces(8).setColors(Arrays.asList(Color.BLACK, Color.WHITE)),
                new ChocolateDTO().setName("蒙牛").setNPieces(2).setColors(Arrays.asList(Color.YELLOW)),
                new ChocolateDTO().setName("伊利").setNPieces(2).setColors(Arrays.asList(Color.BROWN)),
                new ChocolateDTO().setName("德国巧克力").setNPieces(4).setColors(Arrays.asList(Color.RED, Color.WHITE))
        );
    }
}
